# -*- coding: utf-8 -*-
# @author: xiaobai

from autotest.db.session import async_engine
from autotest.models.base import Base
from autotest.models import ui_models
# from autotest.models import data_factory_cp


async def init_db():
    """
    初始化数据库
    :return:
    """
    # class zoDataFactoryOrg(Base):
    #     """造数-组织信息"""
    #     __tablename__ = 'zocp_df_organization_info'
    #
    #     organization_name = mapped_column(String(20), nullable=False, comment="域名称", index=True)
    #     organization_type = mapped_column(Integer, comment='造数接口状态 1 主域 ， 2 子域', default=10)
    #     organization_module_id = mapped_column(BigInteger, nullable=False, comment='主域id')
    #     organization_status = mapped_column(Integer, comment='造数场景状态 10, 生效 ， 20 失效', default=10)
    #     remarks = mapped_column(String(255), comment='描述')

    async with async_engine.begin() as conn:
        # await conn.run_sync(Base.metadata.drop_all)
        await conn.run_sync(Base.metadata.create_all)
